<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>工具</title>
<jsp:include page="public/header.jsp"/>
</head>
<body>
	<jsp:include page="public/nav.jsp"></jsp:include>
	<div class="row ">
		
		<form class="col-xs-6 col-xs-offset-3">
			<h2>用户注册!</h2>
		 <div class="input-group">
		  <span class="input-group-addon">@</span>
		  <input id="email" type="text" class="form-control" placeholder="email">
		</div>
		 <div class="form-group">
		    <label for="name">用户名</label>
		    <input id="name" type="text" class="form-control" placeholder="用户名">
		  </div>
		  <div class="form-group">
		    <label for="pwd">密码</label>
		    <input type="password" class="form-control" id="pwd" placeholder="Password">
		  </div>
		  <div class="form-group">
		    <label for="mobile">手机号码</label>
		    <input id="mobile" type="text" class="form-control" placeholder="手机号码">
		  </div>
		  <button id="register" onclick="return false;" class="btn btn-default">注册</button>
		</form>
	</div>
    
    <jsp:include page="public/footer2.jsp"/>
</body>
<script type="text/javascript">
	$(function(){
		console.log("load complete!!!")
		$("#register").click(function(){
			console.log("submit click!");
			var data = {
					name:$("#name").val(),//名字
					pwd:$("#pwd").val(),//密码
					email:$("#email").val(),
					mobile:$("#mobile").val(),
			};
			var params = {
					url:"/toRegister.html",
					dataType:"json",
					type:"post",
					data:data,
					success:function(data){
						console.log(data);
						alert(data.msg);
						if(data.code == 0){
							window.location.href = data.model;
						}else{
						}
					},
					error:function(){
						alert("服务器异常！！");
					}
			};
			$.ajax(params);
			return false;
		})
	})
	
</script>
</html>